#include <iostream>

#include "aabb.h"

using namespace std;


int isXiangJiao(aabb a,aabb b);
void init();



PointSet p,p1;
aabb ab,ab1;







int main()
{
    cout << "Hello world!" << endl;
    init();
    Matrix<aabb,3,1> aa;
    int xj;
    xj=isXiangJiao(ab,ab1);
    if(0==xj)
    {
        cout<<"buxiangjiao"<<endl;
    }
    else
    {
        cout<<"xiangjiao"<<endl;
    }
    return 0;
}


int isXiangJiao(aabb a,aabb b)
{
    if(a.max[0]<b.min[0]||a.min[0]>b.max[0] || a.max[1]<b.min[1]||a.min[1]>b.max[1] || a.max[2]<b.min[2]||a.min[2]>b.max[2])
        return 0;
    return 1;
}

void init()
{
    int i;

    cout<<"point set"<<endl<<endl;
    p = MatrixXf::Random(3,5);
    p1 = MatrixXf::Random(3,7);
    p1.array() += 1.8;

    cout<<"p:"<<endl<<p<<endl<<endl;
    cout<<"p1:"<<endl<<p1<<endl<<endl;

    ab.reset(p);
    ab1.reset(p1);

    cout<<endl<<"aabb"<<endl<<endl;
    cout<<"ab"<<endl;
    cout<<ab.min<<endl<<endl;
    cout<<ab.max<<endl<<endl;
    cout<<"ab1"<<endl;
    cout<<ab1.min<<endl<<endl;
    cout<<ab1.max<<endl<<endl;
}

